Small Computer System Interface (SCSI) is a set of standards for physically connecting and transferring data between computers and peripheral devices. The SCSI standards define commands, protocols, and electrical and optical interfaces. SCSI is most commonly used for hard disks and tape drives, but it can connect a wide range of other devices, including scanners and CD drives. The SCSI standards define command sets for specific peripheral device types.
SCSI is available in a variety of interfaces. Parallel SCSI (also called SPI) uses a parallel electrical bus design. Serial Attached SCSI (SAS) uses a serial point-to-point design but retains other aspects of the technology. iSCSI drops physical implementation entirely, and instead uses TCP/IP as a transport mechanism
Several recent versions of SCSI, e.g., Serial Storage Architecture (SSA), Fibre Channel (FC), SAS, break from the traditional parallel SCSI standards and perform data transfer via serial communications. Serial SCSI may have a number of advantages over parallel SCSI: faster data rates, hot swapping (some but not all parallel SCSI interfaces support it), and improved fault isolation. A possible reason for the shift to serial interfaces is the clock skew issue of high speed parallel interfaces, which makes the faster variants of parallel SCSI susceptible to problems caused by cabling and termination. Serial SCSI devices, however, may be more expensive than their equivalent parallel SCSI devices.
SCSI interfaces have often been included on computers from manufacturers for use under various operating systems, either implemented on the motherboard or by means of plug-in adaptors.
In addition to many different hardware implementations, the SCSI standards also include a complex set of command protocol definitions. The SCSI command architecture was originally defined for parallel SCSI buses but has been carried forward with minimal change for use with iSCSI and serial SCSI.
In SCSI terminology, communication takes place between an initiator and a target. The initiator sends a command to the target which then responds. SCSI commands are sent in a Command Descriptor Block (CDB). The CDB consists of a one byte operation code followed by five or more bytes containing command-specific parameters. At the end of the command sequence, the target returns a Status Code byte which is usually 00 h for success, 02 h for an error (called a Check Condition), or 08 h for busy. When the target returns a Check Condition in response to a command, the initiator usually then issues a SCSI Request Sense command in order to obtain a Key Code Qualifier from the target. The Check Condition and Request Sense sequence involves a special SCSI protocol called a Contingent Allegiance Condition.
There are 4 categories of SCSI commands: N (non-data), W (writing data from initiator to target), R (reading data), and B (bidirectional). There are about 60 different SCSI commands in total.
Each device on a SCSI bus is assigned at least one Logical Unit Number (LUN). Simple devices may have just one LUN, more complex devices may have multiple LUNs. A “direct access,” e.g., disk type, storage device may include a number of logical blocks, usually referred to by the term Logical Block Address (LBA). A typical LBA equates to 512 bytes of storage. Four different command variants are provided for reading and writing data. The Read(6) and Write(6) commands contain a 21-bit LBA address. The Read(10), Read(12), Read Long, Write(10), Write(12), and Write Long commands all contain a 32-bit LBA address plus various other parameter options.
A “sequential access,” e.g., tape-type, device may not have a specific capacity because it typically depends on the length of the tape, which is not exactly known. Reads and writes on a sequential access device happen at the current position, not at a specific LBA. The block size on sequential access devices can either be fixed or variable, depending on the specific device. Tape devices, such as half-inch 9-track tape, DDS (4 mm tapes physically similar to DAT), Exabyte, etc., support variable block sizes.
SCSI uses a protocol method to transfer data between devices on the bus. It is a circular process which starts and ends in the same layer. From the first layer, all additional layers of protocol are executed before any data is transferred to or from another device and the layers of protocol are completed after the data has been transferred to the end of the process. The protocol layers are referred to as “SCSI bus phases.” These phases are: Bus Free, Arbitration, Selection, Message Out, Command Out, Data Out/In, Status In, Message In and Reselection. The SCSI bus may be in only one phase at a given time.
In the modern SCSI transport protocols, there is an automated process of “discovery” of the IDs. For example, SSA initiators “walk the loop” to determine what devices are there and then assign each one a 7-bit “hop-count” value. FC initiators use the Loop Initialization Protocol to interrogate each device port for its World Wide Name (WWN). For iSCSI, because of the unlimited scope of the IP network, the process may be quite complicated. These discovery processes occur at power-on/initialization time and also if the bus topology changes later, for example if an extra device is added.
On a parallel SCSI bus, a device, e.g. host adapter, disk drive, is identified by a “SCSI ID,” which is a number in the range 0-7 on a narrow bus and in the range 0-15 on a wide bus. Doing I/O to the adapter sets the SCSI ID. For example, the adapter often contains a BIOS program that runs when the computer boots up and that program has menus that let the operator choose the SCSI ID of the host adapter. Alternatively, the host adapter may come with software that is installed on the host computer to configure the SCSI ID. The traditional SCSI ID for a host adapter is 7, as that ID has the highest priority during bus arbitration (even on a 16 bit bus).
The SCSI ID of a device in a drive enclosure that has a backplane may be set either by jumpers or by the slot in the enclosure the device is installed into, depending on the model of the enclosure. In the latter case, each slot on the enclosure's back plane delivers control signals to the drive to select a unique SCSI ID. A SCSI enclosure without a backplane often has a switch for each drive to choose the drive's SCSI ID. The enclosure is packaged with connectors that are plugged into the drive where the jumpers are typically located. The switch emulates the necessary jumpers.
A SCSI target device, which may be called a “physical unit,” is often divided into smaller “logical units.” For example, a high-end disk subsystem may be a single SCSI device but contain dozens of individual disk drives, each of which is a logical unit. More commonly, virtual disk devices may be generated by the subsystem based on the storage in those physical drives, and each virtual disk device is a logical unit. The SCSI ID, WWN, etc. in this case identifies the whole subsystem, and a second number, the LUN identifies a disk device within the subsystem.
It is common to refer to the logical unit itself as a “LUN.” Accordingly, the actual LUN may be called a “LUN number” or “LUN id.”